package cn.cttic.base.api.domain;

import cn.cttic.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serial;
import java.util.Map;

/**
 * 操作记录对象 base_record
 *
 * @author Times.Studio
 * @date 2024-11-13
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("base_record")
public class BaseRecord extends TenantEntity {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 标识
     */
    @TableId(value = "id")
    private String id;

    /**
     * 业务标识
     */
    private String businessId;

    /**
     * 操作分类
     */
    private String actionType;

    /**
     * 操作序号
     */
    private Long actionOrder;

    /**
     * 操作名称
     */
    private String actionName;

    /**
     * 操作类型
     */
    private String actionParams;

    /**
     * 操作人员
     */
    private String actionOperator;

    /**
     * 操作结果
     */
    private String actionResult;

    /**
     * 操作时间
     */
    private Date actionTime;

    /**
     * 操作结果指向
     */
    private String actionResultRef;

    /**
     * 操作结果内容
     */
    private String actionResultContent;

    /**
     * 删除标记
     */
    @TableLogic
    private Long delFlag;


    public static final class BaseRecordBuilder {
        private String id;
        private String businessId;
        private String actionType;
        private Long actionOrder;
        private String actionName;
        private String actionParams;
        private String actionOperator;
        private String actionResult;
        private Date actionTime;
        private String actionResultRef;
        private String actionResultContent;
        private Long delFlag;
        private String tenantId;
        private String searchValue;
        private Long createDept;
        private Long createBy;
        private Date createTime;
        private Long updateBy;
        private Date updateTime;
        private Map<String, Object> params;

        private BaseRecordBuilder() {
        }

        public static BaseRecordBuilder aBaseRecord() {
            return new BaseRecordBuilder();
        }

        public BaseRecordBuilder withId(String id) {
            this.id = id;
            return this;
        }

        public BaseRecordBuilder withBusinessId(String businessId) {
            this.businessId = businessId;
            return this;
        }

        public BaseRecordBuilder withActionType(String actionType) {
            this.actionType = actionType;
            return this;
        }

        public BaseRecordBuilder withActionOrder(Long actionOrder) {
            this.actionOrder = actionOrder;
            return this;
        }

        public BaseRecordBuilder withActionName(String actionName) {
            this.actionName = actionName;
            return this;
        }

        public BaseRecordBuilder withActionParams(String actionParams) {
            this.actionParams = actionParams;
            return this;
        }

        public BaseRecordBuilder withActionOperator(String actionOperator) {
            this.actionOperator = actionOperator;
            return this;
        }

        public BaseRecordBuilder withActionResult(String actionResult) {
            this.actionResult = actionResult;
            return this;
        }

        public BaseRecordBuilder withActionTime(Date actionTime) {
            this.actionTime = actionTime;
            return this;
        }

        public BaseRecordBuilder withActionResultRef(String actionResultRef) {
            this.actionResultRef = actionResultRef;
            return this;
        }

        public BaseRecordBuilder withActionResultContent(String actionResultContent) {
            this.actionResultContent = actionResultContent;
            return this;
        }

        public BaseRecordBuilder withDelFlag(Long delFlag) {
            this.delFlag = delFlag;
            return this;
        }

        public BaseRecordBuilder withTenantId(String tenantId) {
            this.tenantId = tenantId;
            return this;
        }

        public BaseRecordBuilder withSearchValue(String searchValue) {
            this.searchValue = searchValue;
            return this;
        }

        public BaseRecordBuilder withCreateDept(Long createDept) {
            this.createDept = createDept;
            return this;
        }

        public BaseRecordBuilder withCreateBy(Long createBy) {
            this.createBy = createBy;
            return this;
        }

        public BaseRecordBuilder withCreateTime(Date createTime) {
            this.createTime = createTime;
            return this;
        }

        public BaseRecordBuilder withUpdateBy(Long updateBy) {
            this.updateBy = updateBy;
            return this;
        }

        public BaseRecordBuilder withUpdateTime(Date updateTime) {
            this.updateTime = updateTime;
            return this;
        }

        public BaseRecordBuilder withParams(Map<String, Object> params) {
            this.params = params;
            return this;
        }

        public BaseRecord build() {
            BaseRecord baseRecord = new BaseRecord();
            baseRecord.setId(id);
            baseRecord.setBusinessId(businessId);
            baseRecord.setActionType(actionType);
            baseRecord.setActionOrder(actionOrder);
            baseRecord.setActionName(actionName);
            baseRecord.setActionParams(actionParams);
            baseRecord.setActionOperator(actionOperator);
            baseRecord.setActionResult(actionResult);
            baseRecord.setActionTime(actionTime);
            baseRecord.setActionResultRef(actionResultRef);
            baseRecord.setActionResultContent(actionResultContent);
            baseRecord.setDelFlag(delFlag);
            baseRecord.setTenantId(tenantId);
            baseRecord.setSearchValue(searchValue);
            baseRecord.setCreateDept(createDept);
            baseRecord.setCreateBy(createBy);
            baseRecord.setCreateTime(createTime);
            baseRecord.setUpdateBy(updateBy);
            baseRecord.setUpdateTime(updateTime);
            baseRecord.setParams(params);
            return baseRecord;
        }
    }
}
